<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>账号登录-{eyou:global name='web_name' /}</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<link href="{eyou:global name='web_cmspath' /}/favicon.ico" rel="shortcut icon" type="image/x-icon" />
	{eyou:static file="users/skin/css/basic.css" /}
    {eyou:static file="users/skin/css/eyoucms.css" /}
    {eyou:include file="users/skin/css/diy_css.htm" /}

    {eyou:static file="/public/static/common/js/jquery.min.js"/}
    {eyou:static file="/public/plugins/layer-v3.1.0/layer.js"/}
    {eyou:static file="users/skin/js/global.js" /}
    </head>

    <body class="reg login">
<div class="register_index ey-member">
      <div class="container">
    <form action="" name='theForm' id="theForm" method="post" class="form-register panel-body fv-form">
          <div class="mip-reg-logo"><a href="{eyou:global name='web_cmsurl' /}" class="ey-logo"><img src="{eyou:global name='web_logo'/}" /></a></div>
          <div class="mip-reg-heading">账号登录</div>
          <div class="form-group">
        <input type="text" name="username" required class="form-control" placeholder="用户名" autocomplete="off"/>
      </div>
          <div class="form-group">
        <input type="password" name="password" required class="form-control" placeholder="登录密码" autocomplete="off"/>
      </div>
          {eyou:eq name="$is_vertify" value="1"}
          <div class="form-group">
        <div class="input-group-icon">
              <div class="formText">
            <input type="text" name="vertify" autocomplete="off" class="form-control" placeholder="图片验证码" />
            <img src="{eyou:url link='api/Ajax/vertify' vars='type=users_login' /}" class="chicuele" id="imgVerifys" onclick="fleshVerify();" title="看不清？点击更换验证码" align="absmiddle"> </div>
            </div>
      </div>
          {/eyou:eq}
          <input type="hidden" name="referurl" value="{$referurl}"/>
          <input type="hidden" name="website" value="website"/>
          <input type="button" name="submit" class="btn btn-lg btn-primary btn-block" value="登录"/>
          <div class="login-link"> <a href="{eyou:url link='user/Users/reg' /}">注册</a><span>|</span> <a href="{eyou:url link='user/Users/retrieve_password' /}">找回密码</a> </div>
          
          <!-- 第三方账号登录 --> 
          {eyou:include file="/public/static/template/users/users_loginapi.htm" /} 
          <!-- 第三方账号登录 -->
        </form>
  </div>
    </div>
<script type="text/javascript">
    $(document).keydown(function(event){
        if(event.keyCode ==13){
            $('input[name=submit]').trigger("click");
        }
    });

    function fleshVerify(){
        var src = "{eyou:url link='api/Ajax/vertify' vars='type=users_login' /}";
        if (src.indexOf('?') > -1) {
            src += '&';
        } else {
            src += '?';
        }
        src += 'r='+ Math.floor(Math.random()*100);
        $('#imgVerifys').attr('src', src);
    }

    $(function(){
        $('input[name=submit]').on('click',function(){
            var username = $('input[name=username]');
            var password = $('input[name=password]');

            if(username.val() == ''){
                layer.msg('用户名不能为空！', {time: 1500, icon: 5});
                username.focus();
                return false;
            }

            if(password.val() == ''){
                layer.msg('密码不能为空！', {time: 1500, icon: 5});
                password.focus();
                return false;
            }

            layer_loading('正在处理');
            $.ajax({
                // async:false,
                url : "{eyou:url link='user/Users/login' /}",
                data: $('#theForm').serialize(),
                type:'post',
                dataType:'json',
                success:function(res){
                    if (1 == res.code) {
                        if (5 == res.data.status) {
                            layer.alert(res.msg, {icon: 5, title: false, closeBtn: false},function(){
                                window.location.href = res.url;
                            });
                        }else{
                            window.location.href = res.url;
                        }
                    } else {
                        layer.closeAll();
                        if ('vertify' == res.data.status) {
                            fleshVerify();
                        }
                        
                        if (2 == res.data.status) {
                            showErrorAlert(res.msg, 4);
                        } else {
                            layer.msg(res.msg, {icon: 5,time: 1500});
                        }
                    }
                },
                error:function(e) {
                    layer.closeAll();
                    showErrorAlert(e.responseText);
                }
            });
        });
    });
</script>
</body>
</html>